<?php
namespace App\Services\Circle;


use App\Models\Circle;
use App\Models\User;

class CircleJoinUserCoverService {

    public static function handle($circle_id) {
        return \Cache::remember(Circle::CACHE_CIRCLE_COVER_USER . '_' . $circle_id, 3600, function () use($circle_id) {
            return User::select('avatar_url')->join('user_join_circles', function ($join) use($circle_id) {
                $join->on('users.id', 'user_join_circles.user_id')->where('circle_id', $circle_id);
            })->orderBy('hot_search_weight', 'desc')->limit(3)->get();
        });
    }
}